package jd.se.borrowrequest;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BorrowRequestDao {
    List<BorrowRequestShow> showBorrowRequest(String to_id);

    @Delete("insert into borrow(u_id,b_id,return_date,borrow_date) values(#{u_id},#{b_id},DATE_ADD(#{borrow_date}, interval 1 MONTH),#{borrow_date})")
    void insertBorrow(BInfo bInfo);

    @Delete("delete from reserve_info where borrower_id = #{u_id} and b_id = #{b_id}")
    void deleteBorrowRequest(BInfo bInfo);

    @Update("update book set status = 1 where b_id = #{b_id}")
    void updateBookStatus(BInfo bInfo);
}
